﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;

using System.Drawing;

using ScottPlot.Avalonia;
using System.Data;
 

namespace NumericalAnalysis.Display.Mission
{
    public class ScottPlotInit
    {
        /// <summary>
        /// TEST
        /// AvaPlot avaPlot1 = this.Find<AvaPlot>("AvaPlot1");
        /// </summary>
        /// <param name="avaPlot1"></param>
        public static void ScottPlotTest(AvaPlot avaPlot1)
        {
            //AvaPlot avaPlot1 = this.Find<AvaPlot>("AvaPlot1");

            double[] dataX = new double[] { 1, 2, 3, 4, 5 };
            double[] dataY = new double[] { 1, 4, 9, 16, 25 };
            avaPlot1.Plot.AddScatter(dataX, dataY);
            avaPlot1.Refresh();

            avaPlot1.Plot.XLabel("时间");
            avaPlot1.Plot.YLabel("数据");
            avaPlot1.Plot.Title("测试曲线");

            List<double> datetime = new List<double>();
            List<double> value1 = new List<double>();
            List<double> value2 = new List<double>();
            List<double> value3 = new List<double>();
            Random random = new Random();
            datetime.Add(DateTime.Now.ToOADate());
            value1.Add(random.NextDouble() * 10);
            value2.Add(random.NextDouble() * 30);
            value3.Add(random.NextDouble() * 50);

            avaPlot1.Plot.AxisAuto();
            avaPlot1.Plot.AddSignalXY(datetime.ToArray(), value1.ToArray(), Color.Blue);
            avaPlot1.Plot.AddSignalXY(datetime.ToArray(), value2.ToArray(), Color.Red);
            avaPlot1.Plot.AddSignalXY(datetime.ToArray(), value3.ToArray(), Color.Yellow);

            avaPlot1.Refresh();
            Thread.Sleep(1000);

            //while (true)
            //{
            //}

        }


      


    }
}
